home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
SECURITY
/
MNGLR140
/
PASLEX.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-05-01
|
13KB
|
867 lines
(* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
(* global definitions: *)
{*
Pascal lexical analyzer
*}
function yylex : Integer;
procedure yyaction ( yyruleno : Integer );
(* local definitions: *)
var
kw : integer;
Stop : Boolean;
begin
(* actions: *)
case yyruleno of
1:
begin
yytext := UpStr(yytext);
if is_keyword(yytext, kw)
then return(kw)
else return(IDENTIFIER);
end;
2,
3,
4,
5:
return(NUMBER);
6,
7:
return(_CHAR);
8:
return(COLON);
9:
return(SEMICOLON);
10:
return(DOT);
11:
return(DOTDOT);
12:
return(ASSIGNMENT);
13:
return(EQUAL);
14:
return(LPAREN);
15:
return(RPAREN);
16:
return(LBRAC);
17:
return(RBRAC);
18:
return(COMMA);
19:
return(GE);
20:
return(LE);
21:
return(NOTEQUAL);
22:
return(UPARROW);
23:
return(CHARACTER_STRING);
24:
return(DIRECTIVE);
25:
begin
Stop := FALSE;
repeat
if (get_char = '*') and (get_char = ')') then
Stop := TRUE;
until Stop;
end;
26:
begin
repeat
until get_char = '}';
end;
27:
;
28:
begin
if Random(50) = 25 then
WriteProgress;
end;
29:
;
30:
return(OTHER);
end;
end(*yyaction*);
(* DFA table: *)
type YYTRec = record
cc : set of Char;
s : Integer;
end;
const
yynmarks = 54;
yynmatches = 54;
yyntrans = 89;
yynstates = 50;
yyk : array [1..yynmarks] of Integer = (
{ 0: }
{ 1: }
{ 2: }
1,
30,
{ 3: }
30,
{ 4: }
5,
30,
{ 5: }
30,
{ 6: }
30,
{ 7: }
8,
30,
{ 8: }
9,
30,
{ 9: }
10,
30,
{ 10: }
13,
30,
{ 11: }
14,
30,
{ 12: }
15,
30,
{ 13: }
16,
30,
{ 14: }
17,
30,
{ 15: }
18,
30,
{ 16: }
30,
{ 17: }
30,
{ 18: }
22,
30,
{ 19: }
30,
{ 20: }
26,
30,
{ 21: }
27,
30,
{ 22: }
28,
{ 23: }
29,
{ 24: }
30,
{ 25: }
1,
{ 26: }
{ 27: }
5,
{ 28: }
{ 29: }
2,
{ 30: }
4,
{ 31: }
6,
{ 32: }
{ 33: }
12,
{ 34: }
11,
{ 35: }
25,
{ 36: }
19,
{ 37: }
20,
{ 38: }
21,
{ 39: }
{ 40: }
23,
{ 41: }
{ 42: }
3,
{ 43: }
2,
{ 44: }
7,
{ 45: }
24,
{ 46: }
{ 47: }
3
{ 48: }
{ 49: }
);
yym : array [1..yynmatches] of Integer = (
{ 0: }
{ 1: }
{ 2: }
1,
30,
{ 3: }
30,
{ 4: }
5,
30,
{ 5: }
30,
{ 6: }
30,
{ 7: }
8,
30,
{ 8: }
9,
30,
{ 9: }
10,
30,
{ 10: }
13,
30,
{ 11: }
14,
30,
{ 12: }
15,
30,
{ 13: }
16,
30,
{ 14: }
17,
30,
{ 15: }
18,
30,
{ 16: }
30,
{ 17: }
30,
{ 18: }
22,
30,
{ 19: }
30,
{ 20: }
26,
30,
{ 21: }
27,
30,
{ 22: }
28,
{ 23: }
29,
{ 24: }
30,
{ 25: }
1,
{ 26: }
{ 27: }
5,
{ 28: }
{ 29: }
2,
{ 30: }
4,
{ 31: }
6,
{ 32: }
{ 33: }
12,
{ 34: }
11,
{ 35: }
25,
{ 36: }
19,
{ 37: }
20,
{ 38: }
21,
{ 39: }
{ 40: }
23,
{ 41: }
{ 42: }
3,
{ 43: }
2,
{ 44: }
7,
{ 45: }
24,
{ 46: }
{ 47: }
3
{ 48: }
{ 49: }
);
yyt : array [1..yyntrans] of YYTrec = (
{ 0: }
( cc: [ #0 ]; s: 23),
( cc: [ #1..#8,#11,#13..#31,'!','"','%','&','*','+',
'/','?','@','\','`','|'..#255 ]; s: 24),
( cc: [ #9,#12,' ' ]; s: 21),
( cc: [ #10 ]; s: 22),
( cc: [ '#' ]; s: 6),
( cc: [ '$' ]; s: 5),
( cc: [ '''' ]; s: 19),
( cc: [ '(' ]; s: 11),
( cc: [ ')' ]; s: 12),
( cc: [ ',' ]; s: 15),
( cc: [ '-' ]; s: 3),
( cc: [ '.' ]; s: 9),
( cc: [ '0'..'9' ]; s: 4),
( cc: [ ':' ]; s: 7),
( cc: [ ';' ]; s: 8),
( cc: [ '<' ]; s: 17),
( cc: [ '=' ]; s: 10),
( cc: [ '>' ]; s: 16),
( cc: [ 'A'..'Z','_','a'..'z' ]; s: 2),
( cc: [ '[' ]; s: 13),
( cc: [ ']' ]; s: 14),
( cc: [ '^' ]; s: 18),
( cc: [ '{' ]; s: 20),
{ 1: }
( cc: [ #0 ]; s: 23),
( cc: [ #1..#8,#11,#13..#31,'!','"','%','&','*','+',
'/','?','@','\','`','|'..#255 ]; s: 24),
( cc: [ #9,#12,' ' ]; s: 21),
( cc: [ #10 ]; s: 22),
( cc: [ '#' ]; s: 6),
( cc: [ '$' ]; s: 5),
( cc: [ '''' ]; s: 19),
( cc: [ '(' ]; s: 11),
( cc: [ ')' ]; s: 12),
( cc: [ ',' ]; s: 15),
( cc: [ '-' ]; s: 3),
( cc: [ '.' ]; s: 9),
( cc: [ '0'..'9' ]; s: 4),
( cc: [ ':' ]; s: 7),
( cc: [ ';' ]; s: 8),
( cc: [ '<' ]; s: 17),
( cc: [ '=' ]; s: 10),
( cc: [ '>' ]; s: 16),
( cc: [ 'A'..'Z','_','a'..'z' ]; s: 2),
( cc: [ '[' ]; s: 13),
( cc: [ ']' ]; s: 14),
( cc: [ '^' ]; s: 18),
( cc: [ '{' ]; s: 20),
{ 2: }
( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 25),
{ 3: }
( cc: [ '0'..'9' ]; s: 26),
{ 4: }
( cc: [ '.' ]; s: 28),
( cc: [ '0'..'9' ]; s: 27),
( cc: [ 'E' ]; s: 29),
{ 5: }
( cc: [ '0'..'9','A'..'F','a'..'f' ]; s: 30),
{ 6: }
( cc: [ '$' ]; s: 32),
( cc: [ '0'..'9' ]; s: 31),
{ 7: }
( cc: [ '=' ]; s: 33),
{ 8: }
{ 9: }
( cc: [ '.' ]; s: 34),
{ 10: }
{ 11: }
( cc: [ '*' ]; s: 35),
{ 12: }
{ 13: }
{ 14: }
{ 15: }
{ 16: }
( cc: [ '=' ]; s: 36),
{ 17: }
( cc: [ '=' ]; s: 37),
( cc: [ '>' ]; s: 38),
{ 18: }
{ 19: }
( cc: [ #1..'&','('..#255 ]; s: 39),
( cc: [ '''' ]; s: 40),
{ 20: }
( cc: [ '$' ]; s: 41),
{ 21: }
{ 22: }
{ 23: }
{ 24: }
{ 25: }
( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 25),
{ 26: }
( cc: [ '.' ]; s: 48),
( cc: [ '0'..'9' ]; s: 26),
( cc: [ 'E' ]; s: 29),
{ 27: }
( cc: [ '.' ]; s: 28),
( cc: [ '0'..'9' ]; s: 27),
( cc: [ 'E' ]; s: 29),
{ 28: }
( cc: [ '0'..'9' ]; s: 42),
{ 29: }
( cc: [ '+','-' ]; s: 49),
( cc: [ '0'..'9' ]; s: 43),
{ 30: }
( cc: [ '0'..'9','A'..'F','a'..'f' ]; s: 30),
{ 31: }
( cc: [ '0'..'9' ]; s: 31),
{ 32: }
( cc: [ '0'..'9','A'..'F','a'..'f' ]; s: 44),
{ 33: }
{ 34: }
{ 35: }
{ 36: }
{ 37: }
{ 38: }
{ 39: }
( cc: [ #1..'&','('..#255 ]; s: 39),
( cc: [ '''' ]; s: 40),
{ 40: }
( cc: [ '''' ]; s: 39),
{ 41: }
( cc: [ #1..'|','~'..#255 ]; s: 41),
( cc: [ '}' ]; s: 45),
{ 42: }
( cc: [ '0'..'9' ]; s: 47),
( cc: [ 'E' ]; s: 29),
{ 43: }
( cc: [ '0'..'9' ]; s: 43),
{ 44: }
( cc: [ '0'..'9','A'..'F','a'..'f' ]; s: 44),
{ 45: }
{ 46: }
( cc: [ 'E' ]; s: 29),
{ 47: }
( cc: [ '0'..'9' ]; s: 47),
{ 48: }
( cc: [ '0'..'9' ]; s: 46),
{ 49: }
( cc: [ '0'..'9' ]; s: 43)
);
yykl : array [0..yynstates-1] of Integer = (
{ 0: } 1,
{ 1: } 1,
{ 2: } 1,
{ 3: } 3,
{ 4: } 4,
{ 5: } 6,
{ 6: } 7,
{ 7: } 8,
{ 8: } 10,
{ 9: } 12,
{ 10: } 14,
{ 11: } 16,
{ 12: } 18,
{ 13: } 20,
{ 14: } 22,
{ 15: } 24,
{ 16: } 26,
{ 17: } 27,
{ 18: } 28,
{ 19: } 30,
{ 20: } 31,
{ 21: } 33,
{ 22: } 35,
{ 23: } 36,
{ 24: } 37,
{ 25: } 38,
{ 26: } 39,
{ 27: } 39,
{ 28: } 40,
{ 29: } 40,
{ 30: } 41,
{ 31: } 42,
{ 32: } 43,
{ 33: } 43,
{ 34: } 44,
{ 35: } 45,
{ 36: } 46,
{ 37: } 47,
{ 38: } 48,
{ 39: } 49,
{ 40: } 49,
{ 41: } 50,
{ 42: } 50,
{ 43: } 51,
{ 44: } 52,
{ 45: } 53,
{ 46: } 54,
{ 47: } 54,
{ 48: } 55,
{ 49: } 55
);
yykh : array [0..yynstates-1] of Integer = (
{ 0: } 0,
{ 1: } 0,
{ 2: } 2,
{ 3: } 3,
{ 4: } 5,
{ 5: } 6,
{ 6: } 7,
{ 7: } 9,
{ 8: } 11,
{ 9: } 13,
{ 10: } 15,
{ 11: } 17,
{ 12: } 19,
{ 13: } 21,
{ 14: } 23,
{ 15: } 25,
{ 16: } 26,
{ 17: } 27,
{ 18: } 29,
{ 19: } 30,
{ 20: } 32,
{ 21: } 34,
{ 22: } 35,
{ 23: } 36,
{ 24: } 37,
{ 25: } 38,
{ 26: } 38,
{ 27: } 39,
{ 28: } 39,
{ 29: } 40,
{ 30: } 41,
{ 31: } 42,
{ 32: } 42,
{ 33: } 43,
{ 34: } 44,
{ 35: } 45,
{ 36: } 46,
{ 37: } 47,
{ 38: } 48,
{ 39: } 48,
{ 40: } 49,
{ 41: } 49,
{ 42: } 50,
{ 43: } 51,
{ 44: } 52,
{ 45: } 53,
{ 46: } 53,
{ 47: } 54,
{ 48: } 54,
{ 49: } 54
);
yyml : array [0..yynstates-1] of Integer = (
{ 0: } 1,
{ 1: } 1,
{ 2: } 1,
{ 3: } 3,
{ 4: } 4,
{ 5: } 6,
{ 6: } 7,
{ 7: } 8,
{ 8: } 10,
{ 9: } 12,
{ 10: } 14,
{ 11: } 16,
{ 12: } 18,
{ 13: } 20,
{ 14: } 22,
{ 15: } 24,
{ 16: } 26,
{ 17: } 27,
{ 18: } 28,
{ 19: } 30,
{ 20: } 31,
{ 21: } 33,
{ 22: } 35,
{ 23: } 36,
{ 24: } 37,
{ 25: } 38,
{ 26: } 39,
{ 27: } 39,
{ 28: } 40,
{ 29: } 40,
{ 30: } 41,
{ 31: } 42,
{ 32: } 43,
{ 33: } 43,
{ 34: } 44,
{ 35: } 45,
{ 36: } 46,
{ 37: } 47,
{ 38: } 48,
{ 39: } 49,
{ 40: } 49,
{ 41: } 50,
{ 42: } 50,
{ 43: } 51,
{ 44: } 52,
{ 45: } 53,
{ 46: } 54,
{ 47: } 54,
{ 48: } 55,
{ 49: } 55
);
yymh : array [0..yynstates-1] of Integer = (
{ 0: } 0,
{ 1: } 0,
{ 2: } 2,
{ 3: } 3,
{ 4: } 5,
{ 5: } 6,
{ 6: } 7,
{ 7: } 9,
{ 8: } 11,
{ 9: } 13,
{ 10: } 15,
{ 11: } 17,
{ 12: } 19,
{ 13: } 21,
{ 14: } 23,
{ 15: } 25,
{ 16: } 26,
{ 17: } 27,
{ 18: } 29,
{ 19: } 30,
{ 20: } 32,
{ 21: } 34,
{ 22: } 35,
{ 23: } 36,
{ 24: } 37,
{ 25: } 38,
{ 26: } 38,
{ 27: } 39,
{ 28: } 39,
{ 29: } 40,
{ 30: } 41,
{ 31: } 42,
{ 32: } 42,
{ 33: } 43,
{ 34: } 44,
{ 35: } 45,
{ 36: } 46,
{ 37: } 47,
{ 38: } 48,
{ 39: } 48,
{ 40: } 49,
{ 41: } 49,
{ 42: } 50,
{ 43: } 51,
{ 44: } 52,
{ 45: } 53,
{ 46: } 53,
{ 47: } 54,
{ 48: } 54,
{ 49: } 54
);
yytl : array [0..yynstates-1] of Integer = (
{ 0: } 1,
{ 1: } 24,
{ 2: } 47,
{ 3: } 48,
{ 4: } 49,
{ 5: } 52,
{ 6: } 53,
{ 7: } 55,
{ 8: } 56,
{ 9: } 56,
{ 10: } 57,
{ 11: } 57,
{ 12: } 58,
{ 13: } 58,
{ 14: } 58,
{ 15: } 58,
{ 16: } 58,
{ 17: } 59,
{ 18: } 61,
{ 19: } 61,
{ 20: } 63,
{ 21: } 64,
{ 22: } 64,
{ 23: } 64,
{ 24: } 64,
{ 25: } 64,
{ 26: } 65,
{ 27: } 68,
{ 28: } 71,
{ 29: } 72,
{ 30: } 74,
{ 31: } 75,
{ 32: } 76,
{ 33: } 77,
{ 34: } 77,
{ 35: } 77,
{ 36: } 77,
{ 37: } 77,
{ 38: } 77,
{ 39: } 77,
{ 40: } 79,
{ 41: } 80,
{ 42: } 82,
{ 43: } 84,
{ 44: } 85,
{ 45: } 86,
{ 46: } 86,
{ 47: } 87,
{ 48: } 88,
{ 49: } 89
);
yyth : array [0..yynstates-1] of Integer = (
{ 0: } 23,
{ 1: } 46,
{ 2: } 47,
{ 3: } 48,
{ 4: } 51,
{ 5: } 52,
{ 6: } 54,
{ 7: } 55,
{ 8: } 55,
{ 9: } 56,
{ 10: } 56,
{ 11: } 57,
{ 12: } 57,
{ 13: } 57,
{ 14: } 57,
{ 15: } 57,
{ 16: } 58,
{ 17: } 60,
{ 18: } 60,
{ 19: } 62,
{ 20: } 63,
{ 21: } 63,
{ 22: } 63,
{ 23: } 63,
{ 24: } 63,
{ 25: } 64,
{ 26: } 67,
{ 27: } 70,
{ 28: } 71,
{ 29: } 73,
{ 30: } 74,
{ 31: } 75,
{ 32: } 76,
{ 33: } 76,
{ 34: } 76,
{ 35: } 76,
{ 36: } 76,
{ 37: } 76,
{ 38: } 76,
{ 39: } 78,
{ 40: } 79,
{ 41: } 81,
{ 42: } 83,
{ 43: } 84,
{ 44: } 85,
{ 45: } 85,
{ 46: } 86,
{ 47: } 87,
{ 48: } 88,
{ 49: } 89
);
var yyn : Integer;
label start, scan, action;
begin
start:
(* initialize: *)
yynew;
scan:
(* mark positions and matches: *)
for yyn := yykl[yystate] to yykh[yystate] do yymark(yyk[yyn]);
for yyn := yymh[yystate] downto yyml[yystate] do yymatch(yym[yyn]);
if yytl[yystate]>yyth[yystate] then goto action; (* dead state *)
(* get next character: *)
yyscan;
(* determine action: *)
yyn := yytl[yystate];
while (yyn<=yyth[yystate]) and not (yyactchar in yyt[yyn].cc) do inc(yyn);
if yyn>yyth[yystate] then goto action;
(* no transition on yyactchar in this state *)
(* switch to new state: *)
yystate := yyt[yyn].s;
goto scan;
action:
(* execute action: *)
if yyfind(yyrule) then
begin
yyaction(yyrule);
if yyreject then goto action;
end
else if not yydefault and yywrap then
begin
yyclear;
return(0);
end;
if not yydone then goto start;
yylex := yyretval;
end(*yylex*);